﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using WFExtended.Activities;
using WFExtended.Tests.Model;
using Microsoft.Activities.UnitTesting;
using System.ServiceModel;

namespace WFExtended.Tests.Activities
{
    [TestClass]
    public class WcfUriProxyTest : AWcfProxyActivityTest
    {
        public WcfUriProxyTest()
        {
        }

        [TestMethod]
        public void WcfUriStringProxyWithoutInvokerValidationTest()
        {
            base.WcfStringProxyWithoutInvokerValidationTest<WcfUriProxy<String>>();
        }

        [TestMethod]
        public void WcfUriMockServiceProxyWithoutInvokerValidationTest()
        {
            base.WcfMockServiceProxyWithoutInvokerValidationTest<WcfUriProxy<IMockService>>();
        }

        [TestMethod]
        public void WcfUriMockServiceProxyWithInvokerValidationTest()
        {
            base.WcfMockServiceProxyWithInvokerValidationTest<WcfUriProxy<IMockService>, IMockService>();
        }

        [TestMethod]
        public void WcfUriMockServiceProxyWithGenericInvokerValidationTest()
        {
            base.WcfMockServiceProxyWithGenericInvokerValidationTest<WcfUriProxy<IMockService>, IMockService>();
        }

        [TestMethod]
        public void WcfUriMockServiceNoPersistenceProxyValidationTest()
        {
            base.WcfMockServiceNoPersistenceProxyValidationTest<WcfUriProxy<IMockService>, IMockService>();
        }

        [TestMethod]
        [ExpectedException(typeof(ArgumentException))]
        public void WcfUriMockServiceProxyWithoutArgumentExecutionTest()
        {
            var host = WorkflowInvokerTest.Create(new WcfUriProxy<IMockService>());
            host.TestActivity();
        }

        [TestMethod]
        public void WcfUriMockServiceProxyExecutionTest()
        {
            var host = WorkflowInvokerTest.Create(new WcfUriProxy<IMockService>());
            host.InArguments.Binding = new BasicHttpBinding();
            host.InArguments.Uri = new Uri("http://localhost:8889");
            host.TestActivity();
        }
    }
}
